package com.dianzi.certification.controller;

import com.dianzi.certification.service.CertificationService;
import com.dianzi.certification.utils.JwtUtils;
import com.dianzi.certification.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @author copa
 * @createDate 2022-03-30 21:56
 * @function
 */
@RestController
@Api(tags = {"流程：结论认定"})
public class CertResultController {

    @Resource
    private CertificationService certificationService;

    @PreAuthorize("hasAnyAuthority('ROLE_PRINCIPAL')")
    @GetMapping("cert/result")
    @ApiOperation(value = "结论认定 三种值：success/fail/暂时还没有结论噢~")
    public R<String> certResult(HttpServletRequest request) {
        Integer userId = JwtUtils.getUserId(request.getHeader("Authorization"));
        return certificationService.certResult(userId);
    }
}
